package com.du.stutestsys.serverImpl.TeacherManageImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.du.stutestsys.controller.BaseControler;
import com.du.stutestsys.dao.ChapterMapper;
import com.du.stutestsys.entity.Chapter;
import com.du.stutestsys.service.TeacherManage.ChapterService;
import com.du.stutestsys.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChapterServiceImpl implements ChapterService {
    @Autowired
    ChapterMapper chapterMapper;
    QueryWrapper<Chapter> wrapper = new QueryWrapper<>();
    @Override
    public boolean addChapter(Chapter chapter) {
        return chapterMapper.insert(chapter)>0;
    }

    @Override
    public boolean deleteChapter(List<Long> chapterList) {
        return chapterMapper.deleteBatchIds(chapterList)>0;
    }

    @Override
    public boolean updateChapter(Chapter chapter) {
        return chapterMapper.updateById(chapter)>0;
    }

    @Override
    public List<Chapter> selectChapter(Chapter chapter, PageUtil pageUtil) {
        return chapterMapper.selectChapter(chapter,pageUtil);
    }


}
